Music Object Extension - Channels

  Contents

About This Extension

The Channels extension provides convenient access to all the channel properties that can be controlled through the Music Object API. Most of these properties can be accessed using the core Music Object API's setController and getController methods, so this extension is provided primarily to ease programming and to make sonification code more easily understood. As an example, using the Channels extension's setChannelReverbLevel method has the same effect as using the setController method and specifying the value 91 for the ControllerNumber0to127 parameter.

What's New in the Latest Version

There is a dedicated version history for this extension, where you will be able to find out about the new features and possible issues with the most recent version. The version history for this extension is independent of the version history for the core Music Object API.

Getting This Extension

To get the "music-object-x-channels.js" JavaScript file that implements this extension, simply right-click on this link (click-and-hold for Mac users). Then, from the menu that pops up, select the 'Save Link As...' or 'Save Target As...' option and save the file as "music-object-x-channels.js" into an appropriate folder of the local copy of your Web site.

In case you have problems saving the file using the above link, the "music-object-x-channels.js" file can also be found inside the documentation's "javascript" folder, along with the "music-object.js" file.

Dependencies

In order to use this extension, the following JavaScript file(s) must first be sourced in...

For more information on using extensions, consult the section About Music Object Extensions.

Reference

 Name   Short Description 
Instance Methods
getChannelBankNumber Returns an integer value, indicating the bank number of the instrument that is selected for the specified MIDI channel.
getChannelChorusLevel Returns an integer value, indicating the amount of chorus effect that is set for the specified MIDI channel.
getChannelExpression Returns an integer value, indicating the amount of expression that is applied to the specified MIDI channel.
getChannelInstrumentMode Returns an integer value, indicating the current instrument mode for the specified MIDI channel.
getChannelModulation Returns an integer value, indicating the amount of modulation that is applied to the specified MIDI channel.
getChannelNrpn Returns an integer value, indicating the last value that was set for the specified non-registered parameter number (NRPN) on the specified MIDI channel.
getChannelPan Returns an integer value, indicating the stereo positioning of the specified MIDI channel.
getChannelPitchBendRange Returns an integer value, indicating the current pitch bend range set for the specified MIDI channel.
getChannelReverbLevel Returns an integer value, indicating the amount of reverb effect that is set for the specified MIDI channel.
getChannelRpn Returns an integer value, indicating the last value that was set for the specified registered parameter number (RPN) on the specified MIDI channel.
getChannelVolume Returns an integer value, indicating the volume level of the specified MIDI channel.
resetAllControllers Lets you easily reset all the controller values for the specified MIDI channel back to their default settings.
setChannelBankNumber Lets you send a bank select message to the specified MIDI channel.
setChannelChorusLevel Lets you select the amount of chorus effect that is to be applied to the specified MIDI channel.
setChannelExpression Lets you select the amount of expression that is to be applied to the specified MIDI channel.
setChannelInstrumentMode Lets you select the instrument mode for the specified MIDI channel.
setChannelModulation Lets you select the amount of modulation that is to be applied to the specified MIDI channel.
setChannelNrpn Lets you set a value for the specified non-registered parameter number (NRPN) on the specified MIDI channel.
setChannelPan Lets you set the stereo positioning of the specified MIDI channel.
setChannelPitchBendRange Lets you set the pitch bend range (measured in musical intervals) for the specified MIDI channel.
setChannelReverbLevel Lets you select the amount of reverb effect that is to be applied to the specified MIDI channel.
setChannelRpn Lets you set a value for the specified registered parameter number (RPN) on the specified MIDI channel.
setChannelVolume Lets you set the volume level of the specified MIDI channel.
Static Methods
Music.getControllerName Returns a string value, representing the name of the specified MIDI continuous controller number.
Music.midiMsbLsbToInt Lets you convert a MIDI MSB-LSB pair to an integer value.

Instance Methods

 getChannelBankNumber

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelBankNumber method returns an integer value, indicating the bank number of the instrument that is selected for the specified MIDI channel.

SYNTAX    getChannelBankNumber ( MidiChannel1to16 )

RETURN VALUE    BankNumber0to2

Using the getChannelBankNumber method has the same effect as using the getController method and specifying the value 0 for the ControllerNumber0to127 parameter.

For example, the code...

var bankNames = new Array ('General MIDI Bank','Special Bank','User Bank');
var channel3BankName = bankNames [myMusicObject.getChannelBankNumber (3)];

...is equivalent to the code...

var bankNames = new Array ('General MIDI Bank','Special Bank','User Bank');
var channel3BankName = bankNames [myMusicObject.getController (3,0)];

NOTES
 getChannelChorusLevel

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelChorusLevel method returns an integer value, indicating the amount of chorus effect that is set for the specified MIDI channel.

SYNTAX    getChannelChorusLevel ( MidiChannel1to16 )

RETURN VALUE    ChannelChorusLevel0to127

Using the getChannelChorusLevel method has the same effect as using the getController method and specifying the value 93 for the ControllerNumber0to127 parameter.

For example, the code...

var channel3ChorusLevel = myMusicObject.getChannelChorusLevel (3);

...is equivalent to the code...

var channel3ChorusLevel = myMusicObject.getController (3,93);

NOTES
 getChannelExpression

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelExpression method returns an integer value, indicating the amount of expression that is applied to the specified MIDI channel.

SYNTAX    getChannelExpression ( MidiChannel1to16 )

RETURN VALUE    ChannelExpression0to127

Using the getChannelExpression method has the same effect as using the getController method and specifying the value 11 for the ControllerNumber0to127 parameter.

For example, the code...

var channel3Expression = myMusicObject.getChannelExpression (3);

...is equivalent to the code...

var channel3Expression = myMusicObject.getController (3,11);

NOTES
 getChannelInstrumentMode

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelInstrumentMode method returns an integer value, indicating the current instrument mode for the specified MIDI channel.

SYNTAX    getChannelInstrumentMode ( MidiChannel1to16 )

RETURN VALUE    ChannelInstrumentMode0to3

The instrument mode selected for a channel can also be obtained using the getChannelNrpn instance method and specifying the value 640 for the Nrpn0to16383 parameter.

NOTES

Due to a limitation in current versions of the Beatnik Player, the getChannelInstrumentMode method will only return the last instrument mode that was set using the setChannelInstrumentMode or setChannelNrpn instance methods. Because it is possible for instrument mode to be set by MIDI events that occur within an RMF or MIDI file, or by using the setController instance method of the core Music Object API, it is possible that the getChannelInstrumentMode method could return a value that does not reflect the true instrument mode selected for a channel.

So, if you are going to use this method in an interactive audio application, you need to be sure that the RMF or MIDI content you are using does not contain MIDI events that will set instrument mode on channels where your scripting will also be modifying and querying the instrument mode (using the setChannelInstrumentMode and getChannelInstrumentMode methods), and that you also do not use the setController method for setting a channel's instrument mode.

Take a look at the following example...

/*** sets instrument mode 2 for channel 1, using the setChannelInstrumentMode method ***/
myMusicObject.setChannelInstrumentMode (1,2);

/*** sets instrument mode 3 for channel 1, using the setController method ***/
myMusicObject.setController (1,99,5); // non-registered parameter MSB
myMusicObject.setController (1,98,0); // non-registered parameter LSB
myMusicObject.setController (1,6,3);  // non-registered parameter value

/*** alerts the instrument mode for channel 1 ***/
alert (myMusicObject.getChannelInstrumentMode (1));

After the code in this example has been executed, channel 1 will be set to instrument mode 3. However, because the getChannelInstrumentMode method only returns the last instrument mode set by the setChannelInstrumentMode or setChannelNrpn methods, the value 2 will be displayed by the "alert" statement, and not the value 3 as one might expect. This is a limitation that you should be aware of.

NOTES
 getChannelModulation

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelModulation method returns an integer value, indicating the amount of modulation that is applied to the specified MIDI channel.

SYNTAX    getChannelModulation ( MidiChannel1to16 )

RETURN VALUE    ChannelModulation0to127

Using the getChannelModulation method has the same effect as using the getController method and specifying the value 1 for the ControllerNumber0to127 parameter.

For example, the code...

var channel3Modulation = myMusicObject.getChannelModulation (3);

...is equivalent to the code...

var channel3Modulation = myMusicObject.getController (3,1);

NOTES
 getChannelNrpn

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelNrpn method returns an integer value, indicating the last value that was set for the specified non-registered parameter number (NRPN) on the specified MIDI channel.

SYNTAX    getChannelNrpn ( MidiChannel1to16 , Nrpn0to16383 )

RETURN VALUE    NrpnValue0to127

Values can be set for non-registered parameter numbers via scripting using the setChannelNrpn instance method.

NOTES

Due to a limitation in current versions of the Beatnik Player, the getChannelNrpn method will only return the last value that was set for an NRPN using the setChannelNrpn instance method (or the setChannelInstrumentMode instance method, in the case of NRPN 640). Because it is possible for NRPN's to be set by MIDI events that occur within an RMF or MIDI file, or by using the setController instance method of the core Music Object API, it is possible that the getChannelNrpn method could return a value that does not reflect the true value of the specified NRPN for a channel.

So, if you are going to use this method in an interactive audio application, you need to be sure that the RMF or MIDI content you are using does not contain MIDI events that will set the values of the NRPN's you will be using in your application, on channels where your scripting will also be modifying and querying these NRPN values (using the setChannelNrpn and getChannelNrpn methods), and that you also do not use the setController method for setting an NRPN's value.

Take a look at the following example...

/*** sets channel 1's instrument mode (NRPN 640) to 2, using the setChannelNrpn method ***/
myMusicObject.setChannelNrpn (1,640,2);

/*** sets channel 1's instrument mode (NRPN 640) to 3, using the setController method ***/
myMusicObject.setController (1,99,5); // non-registered parameter MSB
myMusicObject.setController (1,98,0); // non-registered parameter LSB
myMusicObject.setController (1,6,3);  // non-registered parameter value

/*** alerts channel 1's instrument mode (NRPN 640) setting ***/
alert (myMusicObject.getChannelNrpn (1,640));

After the code in this example has been executed, channel 1 will be set to instrument mode 3. However, because the getChannelNrpn method only returns the last NRPN value set by the setChannelNrpn method (or the setChannelInstrumentMode method, in the case of NRPN 640), the value 2 will be displayed by the "alert" statement, and not the value 3 as one might expect. This is a limitation that you should be aware of.

NOTES
 getChannelPan

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelPan method returns an integer value, indicating the stereo positioning of the specified MIDI channel.

SYNTAX    getChannelPan ( MidiChannel1to16 )

RETURN VALUE    ChannelPan0to127

Using the getChannelPan method has the same effect as using the getController method and specifying the value 10 for the ControllerNumber0to127 parameter.

For example, the code...

var channel3Pan = myMusicObject.getChannelPan (3);

...is equivalent to the code...

var channel3Pan = myMusicObject.getController (3,10);

NOTES
 getChannelPitchBendRange

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelPitchBendRange method returns an integer value, indicating the current pitch bend range (measured in musical intervals) set for the specified MIDI channel.

SYNTAX    getChannelPitchBendRange ( MidiChannel1to16 )

RETURN VALUE    ChannelPitchBendRangeINT

The pitch bend range selected for a channel can also be obtained using the getChannelRpn instance method and specifying the value 0 for the Rpn0to16383 parameter.

NOTES

Due to a limitation in current versions of the Beatnik Player, the getChannelPitchBendRange method will only return the last pitch bend range that was set using the setChannelPitchBendRange or setChannelRpn instance methods. Because it is possible for pitch bend range to be set by MIDI events that occur within an RMF or MIDI file, or by using the setController instance method of the core Music Object API, it is possible that the getChannelPitchBendRange method could return a value that does not reflect the true pitch bend range selected for a channel.

So, if you are going to use this method in an interactive audio application, you need to be sure that the RMF or MIDI content you are using does not contain MIDI events that will set pitch bend range on channels where your scripting will also be modifying and querying the pitch bend range (using the setChannelPitchBendRange and getChannelPitchBendRange methods), and that you also do not use the setController method for setting a channel's pitch bend range.

Take a look at the following example...

/*** sets channel 1's pitch bend range (RPN 0) to 12, using the setChannelRpn method ***/
myMusicObject.setChannelRpn (1,0,12);

/*** sets channel 1's pitch bend range (RPN 0) to 7, using the setController method ***/
myMusicObject.setController (1,101,0); // registered parameter MSB
myMusicObject.setController (1,100,0); // registered parameter LSB
myMusicObject.setController (1,6,7);   // registered parameter value

/*** alerts channel 1's pitch bend range (RPN 0) setting ***/
alert (myMusicObject.getChannelRpn (1,0));

After the code in this example has been executed, the pitch bend range for channel 1 will be set to 7 musical intervals (a musical 5th). However, because the getChannelRpn method only returns the last RPN value set by the setChannelPitchBendRange or setChannelRpn methods, the value 12 (a full octave) will be displayed by the "alert" statement, and not the value 7 as one might expect. This is a limitation that you should be aware of.

NOTES
 getChannelReverbLevel

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelReverbLevel method returns an integer value, indicating the amount of reverb effect that is set for the specified MIDI channel.

SYNTAX    getChannelReverbLevel ( MidiChannel1to16 )

RETURN VALUE    ChannelReverbLevel0to127

Using the getChannelReverbLevel method has the same effect as using the getController method and specifying the value 91 for the ControllerNumber0to127 parameter.

For example, the code...

var channel3ReverbLevel = myMusicObject.getChannelReverbLevel (3);

...is equivalent to the code...

var channel3ReverbLevel = myMusicObject.getController (3,91);

NOTES
 getChannelRpn

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelRpn method returns an integer value, indicating the last value that was set for the specified registered parameter number (RPN) on the specified MIDI channel.

SYNTAX    getChannelRpn ( MidiChannel1to16 , Rpn0to16383 )

RETURN VALUE    RpnValue0to127

Values can be set for registered parameter numbers via scripting using the setChannelRpn instance method.

NOTES

Due to a limitation in current versions of the Beatnik Player, the getChannelRpn method will only return the last value that was set for an RPN using the setChannelRpn instance method (or the setChannelPitchBendRange instance method, in the case of RPN 0). Because it is possible for RPN's to be set by MIDI events that occur within an RMF or MIDI file, or by using the setController instance method of the core Music Object API, it is possible that the getChannelRpn method could return a value that does not reflect the true value of the specified RPN for a channel.

So, if you are going to use this method in an interactive audio application, you need to be sure that the RMF or MIDI content you are using does not contain MIDI events that will set the values of the RPN's you will be using in your application, on channels where your scripting will also be modifying and querying these RPN values (using the setChannelRpn and getChannelRpn methods), and that you also do not use the setController method for setting an RPN's value.

Take a look at the following example...

/*** sets channel 1's pitch bend range (RPN 0) to 12, using the setChannelRpn method ***/
myMusicObject.setChannelRpn (1,0,12);

/*** sets channel 1's pitch bend range (RPN 0) to 7, using the setController method ***/
myMusicObject.setController (1,101,0); // registered parameter MSB
myMusicObject.setController (1,100,0); // registered parameter LSB
myMusicObject.setController (1,6,7);   // registered parameter value

/*** alerts channel 1's pitch bend range (RPN 0) setting ***/
alert (myMusicObject.getChannelRpn (1,0));

After the code in this example has been executed, the pitch bend range for channel 1 will be set to 7 musical intervals (a musical 5th). However, because the getChannelRpn method only returns the last RPN value set by the setChannelRpn method (or the setChannelPitchBendRange method, in the case of RPN 0), the value 12 (a full octave) will be displayed by the "alert" statement, and not the value 7 as one might expect. This is a limitation that you should be aware of.

NOTES
 getChannelVolume

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getChannelVolume method returns an integer value, indicating the volume level of the specified MIDI channel.

SYNTAX    getChannelVolume ( MidiChannel1to16 )

RETURN VALUE    ChannelVolume0to127

Using the getChannelVolume method has the same effect as using the getController method and specifying the value 7 for the ControllerNumber0to127 parameter.

For example, the code...

var channel3Volume = myMusicObject.getChannelVolume (3);

...is equivalent to the code...

var channel3Volume = myMusicObject.getController (3,7);

NOTES
 resetAllControllers

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The resetAllControllers method lets you easily reset all the controller values for the specified MIDI channel back to their default settings.

SYNTAX    resetAllControllers ( MidiChannel0to16 )

Using the resetAllControllers method has the same effect as using the setController method and specifying the value 121 for the ControllerNumber0to127 parameter, and the value 0 for the ControllerValue0to127 parameter.

For example, the code...

myMusicObject.resetAllControllers (3);

...is equivalent to the code...

myMusicObject.setController (3,121,0);

Because the resetAllControllers method accepts a MidiChannel0to16 parameter, where the value 0 represents all MIDI channels (see the section Important Concepts: Magical MIDI Channel Number 0 and Track Number 0), it is possible to reset all continuous controllers for all MIDI channels of a Music Object instance with a single statement of the form myMusicObject.resetAllControllers (0);.

NOTES
 setChannelBankNumber

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelBankNumber method lets you send a bank select message to the specified MIDI channel.

SYNTAX    setChannelBankNumber ( MidiChannel0to16 , BankNumber0to2 )

Using the setChannelBankNumber method has the same effect as using the setController method and specifying the value 0 for the ControllerNumber0to127 parameter.

For example, the code...

function getBankNumber (bankName) {
   var bankNames = {
      'General MIDI Bank':0,
      'Special Bank':1, 
      'User Bank':2
   }
   return bankNames [bankName];
}

myMusicObject.setChannelBankNumber (3,getBankName ('Special Bank'));

...is equivalent to the code...

function getBankNumber (bankName) {
   var bankNames = {
      'General MIDI Bank':0,
      'Special Bank':1, 
      'User Bank':2
   }
   return bankNames [bankName];
}

myMusicObject.setController (3,0,getBankName ('Special Bank'));

NOTES
 setChannelChorusLevel

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelChorusLevel method lets you select the amount of chorus effect that is to be applied to the specified MIDI channel.

SYNTAX    setChannelChorusLevel ( MidiChannel0to16 , ChannelChorusLevel0to127 )

Using the setChannelChorusLevel method has the same effect as using the setController method and specifying the value 93 for the ControllerNumber0to127 parameter.

For example, the code...

myMusicObject.setChannelChorusLevel (3,61);

...is equivalent to the code...

myMusicObject.setController (3,93,61);

NOTES
 setChannelExpression

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelExpression method lets you select the amount of expression that is to be applied to the specified MIDI channel.

SYNTAX    setChannelExpression ( MidiChannel0to16 , ChannelExpression0to127 )

Using the setChannelExpression method has the same effect as using the setController method and specifying the value 11 for the ControllerNumber0to127 parameter.

For example, the code...

myMusicObject.setChannelExpression (3,127);

...is equivalent to the code...

myMusicObject.setController (3,11,127);

NOTES
 setChannelInstrumentMode

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelInstrumentMode instance method lets you select the instrument mode for the specified MIDI channel.

SYNTAX    setChannelInstrumentMode ( MidiChannel0to16 , ChannelInstrumentMode0to3 )

It is also possible to set instrument mode for a channel using the setChannelNrpn instance method, or the setController instance method of the core Music Object API.

The following sample code examples all have the effect of selecting instrument mode 2 for MIDI channel 3...

Using the setController Method
myMusicObject.setController (3,99,5); // non-registered parameter MSB
myMusicObject.setController (3,98,0); // non-registered parameter LSB
myMusicObject.setController (3,6,2);  // non-registered parameter value
Using the setChannelNrpn Method
myMusicObject.setChannelNrpn (3,640,2);
Using the setChannelInstrumentMode Method
myMusicObject.setChannelInstrumentMode (3,2);

In each of the sample code listings above, the highlighted code indicates where the instrument mode value is specified.

NOTES

Due to a limitation in current versions of the Beatnik Player, the getChannelInstrumentMode instance method will only return the last instrument mode that was set using the setChannelInstrumentMode or setChannelNrpn instance methods. So, if you wish to be able to query the instrument mode for a channel using the getChannelInstrumentMode method, you should use either the setChannelInstrumentMode or setChannelNrpn methods for setting instrument mode, and you should avoid using the setController method for this purpose.

NOTES
 setChannelModulation

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelModulation method lets you select the amount of modulation that is to be applied to the specified MIDI channel.

SYNTAX    setChannelModulation ( MidiChannel0to16 , ChannelModulation0to127 )

Using the setChannelModulation method has the same effect as using the setController method and specifying the value 1 for the ControllerNumber0to127 parameter.

For example, the code...

myMusicObject.setChannelModulation (3,30);

...is equivalent to the code...

myMusicObject.setController (3,1,30);

NOTES
 setChannelNrpn

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelNrpn method lets you set a value for the specified non-registered parameter number (NRPN) on the specified MIDI channel.

SYNTAX    setChannelNrpn ( MidiChannel0to16 , Nrpn0to16383 , NrpnValue0to127 )

Values for non-registered parameter numbers can be queried via scripting using the getChannelNrpn instance method. It is also possible to set values for NRPN's using the setController instance method of the core Music Object API.

The following sample code examples both have the effect of setting 2 for the instrument mode (NRPN 640) of MIDI channel 3...

Using the setController Method
myMusicObject.setController (3,99,5); // non-registered parameter MSB
myMusicObject.setController (3,98,0); // non-registered parameter LSB
myMusicObject.setController (3,6,2);  // non-registered parameter value
Using the setChannelNrpn Method
myMusicObject.setChannelNrpn (3,640,2);

In each of the sample code listings above, the highlighted code indicates where the instrument mode value is specified.

NOTES

Due to a limitation in current versions of the Beatnik Player, the getChannelNrpn instance method will only return the last value that was set for the specified NRPN using the setChannelNrpn instance method (or the setChannelInstrumentMode instance method, in the case of NRPN 640). So, if you wish to be able to query the value of an NRPN for a channel using the getChannelNrpn method, you should use either the setChannelNrpn method (or the setChannelInstrumentMode method, in the case of NRPN 640) for setting the value of the NRPN, and you should avoid using the setController method for this purpose.

NOTES
 setChannelPan

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelPan method lets you set the stereo positioning of the specified MIDI channel.

SYNTAX    setChannelPan ( MidiChannel0to16 , ChannelPan0to127 )

Using the setChannelPan method has the same effect as using the setController method and specifying the value 10 for the ControllerNumber0to127 parameter.

For example, the code...

myMusicObject.setChannelPan (3,0);

...is equivalent to the code...

myMusicObject.setController (3,10,0);

NOTES
 setChannelPitchBendRange

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelPitchBendRange instance method lets you set the pitch bend range (measured in musical intervals) for the specified MIDI channel.

SYNTAX    setChannelPitchBendRange ( MidiChannel0to16 , ChannelPitchBendRangeINT )

It is also possible to set pitch bend range for a channel using the setChannelRpn instance method, or the setController instance method of the core Music Object API.

The following sample code examples all have the effect of setting the pitch bend range to 12 (a full octave) for MIDI channel 3...

Using the setController Method
myMusicObject.setController (3,101,0); // registered parameter MSB
myMusicObject.setController (3,100,0); // registered parameter LSB
myMusicObject.setController (3,6,12);  // registered parameter value
Using the setChannelRpn Method
myMusicObject.setChannelRpn (3,0,12);
Using the setChannelPitchBendRange Method
myMusicObject.setChannelPitchBendRange (3,12);

In each of the sample code listings above, the highlighted code indicates where the pitch bend range value is specified.

NOTES

Due to a limitation in current versions of the Beatnik Player, the getChannelPitchBendRange instance method will only return the last pitch bend range that was set using the setChannelPitchBendRange or setChannelRpn instance methods. So, if you wish to be able to query the pitch bend range for a channel using the getChannelPitchBendRange method, you should use either the setChannelPitchBendRange or setChannelRpn methods for setting pitch bend range, and you should avoid using the setController method for this purpose.

NOTES
 setChannelReverbLevel

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelReverbLevel method lets you select the amount of reverb effect that is to be applied to the specified MIDI channel.

SYNTAX    setChannelReverbLevel ( MidiChannel0to16 , ChannelReverbLevel0to127 )

Using the setChannelReverbLevel method has the same effect as using the setController method and specifying the value 91 for the ControllerNumber0to127 parameter.

For example, the code...

myMusicObject.setChannelReverbLevel (3,15);

...is equivalent to the code...

myMusicObject.setController (3,91,15);

NOTES
 setChannelRpn

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelRpn method lets you set a value for the specified registered parameter number (RPN) on the specified MIDI channel.

SYNTAX    setChannelRpn ( MidiChannel0to16 , Rpn0to16383 , RpnValue0to127 )

Values for registered parameter numbers can be queried via scripting using the getChannelRpn instance method. It is also possible to set values for RPN's using the setController instance method of the core Music Object API.

The following sample code examples both have the effect of setting 12 for the pitch bend range (RPN 0) of MIDI channel 3...

Using the setController Method
myMusicObject.setController (3,101,0); // registered parameter MSB
myMusicObject.setController (3,100,0); // registered parameter LSB
myMusicObject.setController (3,6,12);  // registered parameter value
Using the setChannelRpn Method
myMusicObject.setChannelRpn (3,0,12);

In each of the sample code listings above, the highlighted code indicates where the instrument mode value is specified.

NOTES

Due to a limitation in current versions of the Beatnik Player, the getChannelRpn instance method will only return the last value that was set for the specified RPN using the setChannelRpn instance method (or the setChannelPitchBendRange instance method, in the case of RPN 0). So, if you wish to be able to query the value of an RPN for a channel using the getChannelRpn method, you should use either the setChannelRpn method (or the setChannelPitchBendRange method, in the case of RPN 0) for setting the value of the RPN, and you should avoid using the setController method for this purpose.

NOTES
 setChannelVolume

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setChannelVolume method lets you set the volume level of the specified MIDI channel.

SYNTAX    setChannelVolume ( MidiChannel0to16 , ChannelVolume0to127 )

Using the setChannelVolume method has the same effect as using the setController method and specifying the value 7 for the ControllerNumber0to127 parameter.

For example, the code...

myMusicObject.setChannelVolume (3,127);

...is equivalent to the code...

myMusicObject.setController (3,7,127);

NOTES
Static Methods

 Music.getControllerName

 
 CATEGORY   Static Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 

The Music.getControllerName static method returns a string value, representing the name of the specified MIDI continuous controller number.

SYNTAX    getControllerName ( ControllerNumber0to127 )

RETURN VALUE    ControllerNameSTR

The following table shows all the possible values that can be returned by this method...

Method Call Return Value
Music.getControllerName (0) "Bank Number"
Music.getControllerName (1) "Modulation"
Music.getControllerName (7) "Volume"
Music.getControllerName (10) "Pan"
Music.getControllerName (11) "Expression"
Music.getControllerName (91) "Reverb Level"
Music.getControllerName (93) "Chorus Level"

NOTES

As a rule, symbolic controller names are only returned for MIDI controller numbers for which the Channels extension provides get- and set- style methods (such as getChannelExpression and setChannelExpression).

There may be other MIDI controllers that are supported by the player (see the appendix Supported MIDI Controllers) for which the Music.getControllerName method will not return a dedicated symbolic name. One such example is MIDI controller number 98, which is the "Non-registered Parameter Number LSB" controller. There are also a good number of MIDI controllers that are not supported by the player. If, for whatever reason, the Music.getControllerName method does not know the symbolic name of the specified MIDI controller number, then the method will simply return the specified MIDI controller number as a string in the form "MIDI Controller [ControllerNumber0to127]". So, the statement Music.getControllerName (98); would return the value "MIDI Controller 98".

 Music.midiMsbLsbToInt

 
 CATEGORY   Static Method 
 MODULE   Music Object Extension - Channels 
 Min. Player Version   1.0.0 
 

The Music.midiMsbLsbToInt static method lets you convert a MIDI MSB-LSB pair to an integer value.

SYNTAX    Music.midiMsbLsbToInt ( Msb0to127 , Lsb0to127 )

RETURN VALUE    Integer0to16383

With the MIDI communication protocol, many values are constrained to a single 7-bit byte (where one bit is reserved as a flag). This means, of course, that these values are constrained to the range of 0 through 127. It is no coincidence that values for MIDI continuous controllers, such as channel volume, are constrained to this range. And it is no coincidence that note numbers for MIDI note events are constrained to this range. And it is also no coincidence that there are 128 MIDI continuous controllers in total.

Now, in order to offer a large set of registered parameter numbers (RPN) and non-registered parameter numbers (NRPN), so that these parameters don't suffer the same ultimate scarcity as the rather limited set of 128 MIDI continuous controllers, it was decided to use two 7-bit bytes for specifying RPN's and NRPN's. These two bytes are combined together to form a 14-bit number. One byte, called the MSB (Most Significant Byte), is used to represent the upper 7 bits, while the other byte, called the LSB (Least Significant Byte), is used to represent the lower 7 bits.

For example, an MSB-LSB pair where the MSB value is 5 and where the LSB value is 0 would represent the number 640. NRPN 640 is the NRPN that is used to set a channel's instrument mode (see the section Important Concepts: Channel Instrument Mode). If you have used RPN's or NRPN's in music compositions, then you will most probably have had plenty of experience specifying these parameters by their MSB-LSB pair in your music sequencer's MIDI event view. Because all the methods in this extension that deal with registered and non-registered parameter numbers take a single integer value for specifying these parameters' numbers, the Music.midiMsbLsbToInt method is provided as a convenience in case you have become accustomed to thinking of RPN's and NRPN's in terms of their MSB-LSB pair.

To illustrate our example for NRPN 640, the code...

myMusicObject.setChannelNrpn (1,Music.midiMsbLsbToInt (5,0),2);

...is equivalent to the code...

myMusicObject.setChannelNrpn (1,640,2);

NOTES